<template>
  <el-dialog :title="title" :visible.sync="open" width="600px" destroy-on-close append-to-body>
    <el-form :model="formData" size="small" label-width="80px" ref="form">
      <el-row>
        <el-col :span="24">
          <el-form-item label="任务内容" prop="cate">
            {{ task.taskContent }}
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="执行人">
            {{ task.userName }}
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="提醒方式" prop="countText">
            <el-radio-group v-model="warnType">
              <el-radio :label="0">消息提醒</el-radio>
              <el-radio :label="1">弹窗提醒</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="close">取 消</el-button>
      <el-button type="primary" @click="sendWarn">发送提醒</el-button>
    </div>
  </el-dialog>
</template>

<script>
import dialogMixin from "@/mixins/dialogMixin";
import TaskWarnMsg from "@/plugins/chat/msgType/TaskWarnMsg";

export default {
  name: "TaskExecuteDialog",
  mixins: [dialogMixin],
  data() {
    return {
      title: "任务提醒",
      formData: {},
      task: {},
      warnType: 0,
    };
  },
  mounted() {},
  computed: {},
  methods: {
    showDialog(task) {
      this.task = task;
      this.show();
    },
    sendWarn() {
      let warnMsg = new TaskWarnMsg();
      warnMsg.setWarnType(this.warnType).setWarnChannel("drill").setTaskId(this.task.taskId).setTaskContent(this.task.taskContent).setReceiveUserId(this.task.userId).setReceiveUserName(this.task.userName);
      this.$chat.sendTaskMsg(warnMsg, "notice");
      this.$modal.msgSuccess("任务提醒发送成功");
      this.close();
    },
  },
};
</script>

<style lang="scss" scoped></style>
